<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateYsGiftsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('gifts', function(Blueprint $table)
		{
			$table->increments('id')->comment('主键id');
			$table->tinyInteger('gift_id')->comment('礼物id');
			$table->integer('gifts_time')->comment('送礼时间');
			$table->bigInteger('uid')->comment('送礼用户');
			$table->bigInteger('gifts_uid')->comment('收礼用户');
			$table->smallInteger('counts')->nullable()->default(1)->comment('送礼数量');
			$table->string('relation', 32)->nullable()->index('gifts_relation_index')->comment('关联书籍或者章节编号空时不关联');
			$table->tinyInteger('type')->nullable()->default(0)->index('gifts_type_index')->comment('属性为0 时不关联书籍或者吧为1时关联吧2时关联书籍');
			$table->float('real_money', 10)->default(0.00)->comment('产生的实际收益');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('gifts');
	}

}
